package com.example.graduatetest.activitys;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProviders;

import android.content.Intent;
import android.os.Bundle;

import com.example.graduatetest.R;
import com.example.graduatetest.databinding.ActivityUploadScoreBinding;
import com.example.graduatetest.view.model.TeacherPersonViewModel;
import com.example.graduatetest.view.model.UploadScoreViewModel;

public class UploadScoreActivity extends AppCompatActivity {
    private ActivityUploadScoreBinding binding;
    private UploadScoreViewModel viewModel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_upload_score);

        //隐藏ActionBar
        if(getSupportActionBar() != null){
            ActionBar actionBar = getSupportActionBar();
            actionBar.hide();
        }
        binding = DataBindingUtil.setContentView(this,R.layout.activity_upload_score);


        //接受Intent传来的数据
        Intent intent = getIntent();
        String class_name = intent.getStringExtra("class_name");
        String class_number_send = intent.getStringExtra("class_number_send");

        //LiveData
        viewModel = ViewModelProviders.of(this).get(UploadScoreViewModel.class);
        binding.setUploadScoreViewModel(viewModel);
        binding.setLifecycleOwner(this);
        viewModel.init(this,binding,class_name,class_number_send);
    }
}
